import os
import pytest
import subprocess


def run():
    # 运行测试用例
    pytest.main(['-v',
                 './case/test_case05.py',
                 '--alluredir',
                 './result',
                 '--clean-alluredir'
                 ])

    # 生成并打开 Allure 报告
    allure_path = os.path.join(os.getcwd(), 'allure', 'allure-2.24.1', 'bin', 'allure.bat')
    subprocess.Popen([allure_path, 'serve', './result'], shell=True)

    # 等待用户输入以防止窗口关闭
    os.system("pause")


if __name__ == "__main__":
    run()
